<!DOCTYPE html>
<html lang="en" style="background:#fff;">
<head>
<base href="${basePath}">
	<#include "common/top.html"/>
	<link type="text/css" rel="stylesheet" href="${basePath}plugins/zTree/3.5.1/zTreeStyle/zTreeStyle.css"/>
	<script type="text/javascript" src="${basePath}plugins/zTree/3.5.1/jquery.ztree.core.js"></script>
	<script type="text/javascript" src="${basePath}plugins/zTree/3.5.1/jquery.ztree.excheck.js"></script>
</head>
<body style="background:#fff;">
	<form class="layui-form" modelAttribute="emp" name="form1" id="form1"  method="post">
		<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">*</span>企业员工编号：</label>
			<div class="layui-input-inline">
				<input class="layui-input" type="text" name="comUserCode" id="comUserCode" placeholder="请输入企业员工编号" value="${comEmp.comUserCode}"  title="员工编号"/>
			</div>
		</div>
		<!--<div class="layui-form-item-dept">-->
		<!--<input type="text" name="comUserCode" id="comUserCode" value="${comEmp.comUserCode }"/>-->
		<!--<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">*</span>企业员工CODE：</label>
			<div class="layui-input-inline">
				<input class="layui-input" type="text" name="comUserCode" id="comUserCode" placeholder="请输入企业员工CODE" value="${ComEmp.comUserCode}"  title="账号"/>
			</div>
		</div>-->
		<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">*</span>企业员工名称：</label>
			<div class="layui-input-inline">
			<input class="layui-input" type="text" name="comUserName" id="comUserName" placeholder="请输入企业员工名称" value="${comEmp.comUserName}"  title="员工名称"/>
			</div>
		</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>密码：</label>
				<div class="layui-input-inline">
					<input class="layui-input" type="text" name="userPassword" id="userPassword" placeholder="请输入密码" title="密码"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>所属企业：</label>
				<div class="layui-input-inline">
					<input class="layui-input" type="text" name="comCode" id="comCode" placeholder="请输入所属企业" value="${comEmp.comCode}"  title="所属企业"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>职位名称：</label>
				<div class="layui-input-inline">
					<input class="layui-input" type="text" name="postName" id="postName" placeholder="请输入职位名称" value="${comEmp.postName}"  title="职位名称"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>座机号：</label>
				<div class="layui-input-inline">
					<input class="layui-input" type="text" name="contactTel" id="contactTel" placeholder="请输入座机号" value="${comEmp.contactTel}"  title="座机号"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>身份证号码：</label>
				<div class="layui-input-inline">
					<input class="layui-input" type="text" name="idNo" id="idNo" placeholder="请输入身份证号码" value="${comEmp.idNo}"  title="身份证号码"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>联系人手机号：</label>
				<div class="layui-input-inline">
					<input class="layui-input" type="text" name="contactMobile" id="contactMobile" placeholder="请输入联系人手机号" value="${comEmp.contactMobile}"  title="联系人手机号"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>地址：</label>
				<div class="layui-input-inline">
					<input class="layui-input" type="text" name="address" id="address" placeholder="请输入地址" value="${comEmp.address}"  title="地址"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>部门编号：</label>
				<div class="layui-input-inline">
					<input class="layui-input" type="text" name="deptCode" id="deptCode" placeholder="请输入本级部门编号" value="${comEmp.deptCode}"  title="部门名称"/>
				</div>
			</div>
				<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>部门名称：</label>
				<div class="layui-input-inline">
					<input class="layui-input" type="text" name="deptName" id="deptName" placeholder="请输入本级部门名称" value="${comEmp.deptName}"  title="部门名称"/>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>数据更新日期：</label>
				<div class="layui-input-inline">
					<input class="layui-input" type="text" name="smodLastDate" id="smodLastDate" placeholder="请输入数据更新日期" value="${comEmp.smodLastDate}"  title="部门名称"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><span style="color: red;">*</span>数据维护人员：</label>
				<div class="layui-input-inline">
					<input class="layui-input" type="text" name="modUser" id="modUser" placeholder="请输入数据维护人员" value="${comEmp.modUser}"  title="部门名称"/>
				</div>
			</div>
		</div>
	</div>
	</form>
</body>
<script type="text/javascript">
	var zTree;
	$(document).ready(function(){
		if($("#comUserCode").val()!=""){
		/*	$("#comUserName").attr("readonly","readonly");
			$("#deptName").attr("disabled",false).css("color","gray");
			$("#postName").attr("readonly","readonly").css("color","gray");
			$("#comUserName").css("color","gray");*/
		}
	/*	$("#parentDiv").hide();
		$("#deptName").click(function(event){
			$("#parentDiv").show();
			event.stopPropagation();//阻止 冒泡
		});
		$("body").click(function(){
			$("#parentDiv").hide();
		})
		$('#parentDiv').click(function(){
			return false;
		});
		var zn = '${zTreeNodes}';
		var setting = {
			data: {
				key: {
					title: "dept"
				},
				simpleData: {
					enable: true,
					idKey: "id",
					pIdKey: "pId",
					rootPId: 0
				}
			},
			callback:{
				onClick: zTreeOnClick
			}
		};
		var zNodes = eval(zn);
		zTree = $.fn.zTree.init($("#tree"), setting, zNodes);*/
	});
	/*function zTreeOnClick(event, treeId, treeNode) {
		$("#deptId").val(treeNode.id);
		$("#deptName").val(treeNode.name);
		$("#parentDiv").hide();
	}*/
	//保存
	function save(){

		if(
			checkIsNull("comUserName","请输入用户名！")||
			checkIsNull("postName","请输入姓名！")||
			checkIsNull("deptName","请输入部门名称！")
			//checkPhone("phone")
		){
			return;
		}
	/*	//判断邮箱
		var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
		if($("#email").val()!="" && $("#email").val()!=null) {
			if(!(reg.test($("#email").val()))){
				$("#email").tips({
					side : 3,
					msg : '邮箱输入有误',
					bg : '#fe5d6f',
					time : 2
				});
				$("#email").focus();
				return false;
			}
		}*/
		
		if($("#comUserCode").val()=="" && $("#userPassword").val()==""){
			$("#userPassword").tips({
				side:3,
	            msg:'输入密码',
	            bg:'#fe5d6f',
	            time:2
	        });
			$("#userPassword").focus();
			return false;
		}
		/*if($("#userPassword").val()!=$("#chkpwd").val()){

			$("#chkpwd").tips({
				side:3,
	            msg:'两次密码不相同',
	            bg:'#fe5d6f',
	            time:3
	        });
			$("#chkpwd").focus();
			return false;
		}*/
		//密码格式验证
		/*var reg = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{4,16}$/;
		var flag = reg.test($("#passWord").val());
		if(flag == false){
			$("#passWord").tips({
				side:3,
				msg:'新密码必须由 4-16位字母、数字、特殊符号线组成',
				bg:'#fe5d6f',
				time:3
			});
			$("#passWord").focus();
			//alert("新密码必须由 4-16位字母、数字、特殊符号线组成.");
			return false;
		}*/

		$.ajax({
			url: '${basePath}/sysuser/user/updateEmp.do',
			data: $("#form1").serialize(),
			type: "POST",
			success: function(data){
				if (data.status == 'success') {
					parent.layer.alert(data.msg,function(index){
						var index1 = parent.layer.getFrameIndex(window.name); //获取窗口索引
						parent.layer.close(index1);
						parent.layer.close(index);
					});
				}else{
					parent.layer.alert(data.msg);
				}
			}
		});
    }
</script>
</body>
</html>